Skip to content

Conversation

@malayladu
Copy link
Contributor

@malayladu malayladu commented Mar 7, 2025

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/2857827771/78525

Summary

This PR supports merge tags in the field_filters attribute. That means the following shortcode will work as expected.

[gravityforms action="entry_count" id="21" field_filters="31:is:{user:user_login},29:is:"]

@malayladu malayladu self-assigned this Mar 7, 2025
@github-actions
Copy link

github-actions bot commented Mar 7, 2025

Warnings
⚠️ When ready, don't forget to request reviews on this pull request from your fellow wizards.

Generated by 🚫 dangerJS against 82a4073

Copy link
Contributor

@saifsultanc saifsultanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@claygriffiths claygriffiths requested a review from Copilot March 8, 2025 15:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@claygriffiths
Copy link
Contributor

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2025

Walkthrough

The pull request enhances the shortcode processing in gravity-forms/gw-entry-count-shortcode-advanced.php by adding logic to handle merge tags found within the field_filters attribute. When a filter pair contains a merge tag (detected via GFCommon::has_merge_tag), the tag is replaced with its corresponding value through GFCommon::replace_variables_prepopulate. This additional processing ensures that merge tags are dynamically substituted before the filter pairs are parsed further, without altering the overall structure of the code.

Changes

File Change Summary
gravity-forms/…/gw-entry-count-shortcode-advanced.php Added a conditional block to detect merge tags in filter pairs and replace them dynamically using GFCommon::has_merge_tag and GFCommon::replace_variables_prepopulate.

Sequence Diagram(s)

sequenceDiagram
    participant SH as Shortcode Handler
    participant GF as GFCommon Utility
    SH->>SH: Iterate through each filter pair
    alt Merge tag detected?
        SH->>GF: has_merge_tag(pair)
        GF-->>SH: true
        SH->>GF: replace_variables_prepopulate(pair)
        GF-->>SH: Return replacement value
    else No merge tag
        SH->>SH: Continue with standard filter parsing
    end
Loading

Poem

I’m a bunny in the code garden, hopping with glee,
Seeing merge tags hiding where they ought to be.
With a twitch and a hop, they’re swapped in a snap,
Bringing dynamic magic into every filter map.
A joyful leap of code—🐇 cheers in every gap!

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
gravity-forms/gw-entry-count-shortcode-advanced.php (1)

12-12: Consider updating the documentation.

Since merge tag support has been added to field filters, it would be helpful to update this line in the documentation to explicitly mention that field_filters now supports merge tags.

- * - field_filters (string): A comma-separated list of field filters in the format field_id:operator:value.
+ * - field_filters (string): A comma-separated list of field filters in the format field_id:operator:value. Supports merge tags.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4083892 and 82a4073.

📒 Files selected for processing (1)
  • gravity-forms/gw-entry-count-shortcode-advanced.php (1 hunks)
🔇 Additional comments (1)
gravity-forms/gw-entry-count-shortcode-advanced.php (1)

64-67: Implementation looks good!

This change correctly adds support for merge tags in field filters by detecting and replacing them before splitting the filter pair into components. The implementation is consistent with how merge tags are handled for the value attribute in lines 49-52.

@malayladu malayladu merged commit 6b9e42a into master Mar 12, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants